package io.renren.modules.cards.service.impl;

import io.renren.common.utils.StringUtils;
import io.renren.modules.cards.dao.AmgCdkAgentDao;
import io.renren.modules.cards.entity.AmgCdkAgentEntity;
import io.renren.modules.cards.service.AmgCdkAgentService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;




@Service("amgCdkAgentService")
public class AmgCdkAgentServiceImpl extends ServiceImpl<AmgCdkAgentDao, AmgCdkAgentEntity> implements AmgCdkAgentService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<AmgCdkAgentEntity> page = this.selectPage(
                new Query<AmgCdkAgentEntity>(params).getPage(),
                new EntityWrapper<AmgCdkAgentEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<AmgCdkAgentEntity> queryForStatusList(String status) {
        EntityWrapper<AmgCdkAgentEntity> entityWrapper = new EntityWrapper<>();
        entityWrapper.where("1=1");
        if(!StringUtils.isNull(status)){
            entityWrapper.andNew("status={0}", 0);
        }
        entityWrapper.orderBy("id", true);
        List<AmgCdkAgentEntity> list = this.selectList(
                entityWrapper
        );
        return list;
    }

}
